{% extends "page_base.html" %}
{% block page_title %}Status{% endblock %}

{% block page_head %}
<meta http-equiv="refresh" content="300" />
<script type="text/javascript" src="/js/status.js"></script>
<link href="/css/status.css" rel="stylesheet" type="text/css" />
{% endblock page_head %}

{% block content %}
<div id="header">
<div id="heading-line">
<h1>~Spline Service Manager</h1>
<h4>{{ webControl.hostName }} | Falcon Interface</h4>
</div>

<div id="huds">
Version: {{ spline.version }}<br />
Uptime: {{ spline.stats.running_duration }} (seconds)<br />
Process Id: {{ spline.stats.process_id }}<br />
<a href="?action=reload-views">(reload web-app)</a>
</div>
</div>

<div id="sidebar">
<h2>Actions</h2>
<ul>
  <li><a class="snow-link cursor" onclick="return showOrHide('managerSubActions');">
      Manager</a>
      <ul id="managerSubActions" class="subaction" style="display: none">
        <li><a href="?action=shutdown-manager" class="snow-link cursor"
               onclick="return confirm('Do you REALLY want to shutdown the manager?');">Shutdown</a></li>
      </ul>
      </li>

  <li><a class="snow-link cursor" onclick="return showOrHide('partnersSubActions');">
      Partners</a>
      <ul id="partnersSubActions" class="subaction" style="display: none">
        <li>View</li>
        <li>Add</li>
      </ul>
      </li>

  <li><a class="snow-link cursor" onclick="return showOrHide('logSubActions');">
      Logs</a>
      <ul id="logSubActions" class="subaction" style="display: none">
        <li><a class="snow-link cursor" onclick="return showOrHide('pageMessages');">
            Messages</a></li>
      </ul>
  {% if documentation %}
  <li><a class="snow-link" target="blank"
         href="{{ documentation.link }}/index.html">Documentation</a></li>
  {% endif %}
</ul>
</div>

<div id="detail">
<a class="blackice-link cursor" style="float: right"
   onclick="return showOrHide('managerConfiguration');">
Manager Configuration
</a>
<pre id="managerConfiguration" class="manager-config"
     style="display: none">{{ spline.mgrConfig }}</pre>

<h2>Partners</h2>

<table id="partners">
{% for p in spline.partners %}
<tr><td class="partner-name" colspan="2" align="right">
    {% if p.weblink %}
      <a target="blank" href="{{ p.weblink }}">{{ p.name }}
    {% else %}
      {{ p.name }}
    {% endif %}
    </td></tr>

<tr><td colspan="2">&nbsp;</td></tr>

<tr><td class="left">Service Port:</td>
    <td class="right">{{ p.service_port }}</td></tr>

<tr><td class="left">Booted At:</td>
    <td class="right">{{ p.boottime }}</td></tr>

<tr><td class="left">Configuration:</td>
    <td class="right config-button">
    <a class="content-link" href="javascript:showOrHide('partnerConfig{{ p.nr }}');">
    {{ p.config_file }}
    </a>
    </td></tr>

<tr id="partnerConfig{{ p.nr }}" style="display: none">
    <td class="configuration" colspan="2">
    <pre>{{ p.configuration }}</pre>
    </td></tr>

<tr><td colspan="2">&nbsp;</td></tr>
{% endfor %}
</table>

<div id="pageMessages" style="display: none">
<h2>Messages</h2>

<ul>
{% for m in messages %}
  <li><pre class="message">{{ m }}</pre></li>
{% endfor %}
</ul>
</div>

</div>
{% endblock %}
